﻿namespace Pattern_package.GUI
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;

    /// <summary>
    /// choose color foreach class
    /// </summary>
    public partial class Choose_color : Form
    {
        int i = 0;
        public Choose_color()
        {
            InitializeComponent();
        }
        public List<Color> ForEach = new List<Color>();

        /// <summary>
        /// Sets the info need from calling class.
        /// </summary>
        /// <param name="NumberOfClass">The number of class.</param>
        public void SetInfo(int NumberOfClass)
        {
            dataGridView1.Rows.Clear();
            dataGridView1.Rows.Add(NumberOfClass);
            for (int i = 0; i < NumberOfClass; i++)
            {
                dataGridView1.Rows[i].Cells[0].Value = "Color of class" + i.ToString();

            }
        }

        /// <summary>
        /// Handles the CellClick event of the dataGridView1 control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.DataGridViewCellEventArgs"/> instance containing the event data.</param>
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DialogResult d = this.colorDialog1.ShowDialog();
            this.ForEach.Add(this.colorDialog1.Color);
            i++;
        }

        /// <summary>
        /// Handles the Click event of the BtnEnd control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void BtnEnd_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
